package com.mmsj;

import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.TextView;

import androidx.activity.EdgeToEdge;
import androidx.appcompat.app.AppCompatActivity;
import androidx.core.graphics.Insets;
import androidx.core.view.ViewCompat;
import androidx.core.view.WindowInsetsCompat;

public class RegisterActivity extends AppCompatActivity {

    private EditText etUserName;
    private EditText etPassword;
    private EditText etConfirmPassword;
    private EditText etPhone;
    private Button btnRegister;
    private TextView tvLogin;

    private String strUserName;
    private String strPassword;
    private String strConfirmPassword;
    private String strPhone;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        // 初始化UI
        setContentView(R.layout.activity_register);
        etUserName = findViewById(R.id.et_username);
        etPassword = findViewById(R.id.et_password);
        etConfirmPassword = findViewById(R.id.et_confirm_password);
        etPhone = findViewById(R.id.et_phone);
        btnRegister = findViewById(R.id.btn_register);
        tvLogin = findViewById(R.id.tv_login);

        // 注册按钮的点击事件
        btnRegister.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                // 获取输入框的输入文本
                strUserName = etUserName.getText().toString().trim();
                strPassword = etPassword.getText().toString().trim();
                strConfirmPassword = etConfirmPassword.getText().toString().trim();
                strPhone = etPhone.getText().toString().trim();
                // 在以下空白处补充代码


            }
        });

        // 点击登录的点击事件，跳转至登录页面
        tvLogin.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                Intent myIntent = new Intent(RegisterActivity.this, LoginActivity.class);
                startActivity(myIntent);
            }
        });


    }
}